package com.ruike.alisurface.ui.mainPage;

import android.view.View;

import com.ruike.alisurface.Constant;
import com.ruike.alisurface.R;
import com.ruike.alisurface.Serials.MsgEventBus;
import com.ruike.alisurface.base.BaseAty;
import com.ruike.alisurface.ui.payPage.PayForSweepActivity;
import com.ruike.alisurface.utils.ShareKey;
import com.voodoo.lib_utils.L;
import com.voodoo.lib_utils.ShareUtils;

import butterknife.OnClick;

public class ShowMainTypeActivity extends BaseAty {

    @Override
    public void doEventBusResult(MsgEventBus event) {
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.activity_show_main_type;
    }

    @Override
    protected void initViews() {
        boolean isOpenAdv = ShareUtils.getInstance().getInt(ShareKey.ADV_TYPE, Constant.ADV_TYPE_NONE) == Constant.ADV_TYPE_NONE;
        L.i("sp 广告类型：", ShareUtils.getInstance().getInt(ShareKey.ADV_TYPE, Constant.ADV_TYPE_NONE));
        initTitleBar(isOpenAdv);
        if (!isOpenAdv) {
            startCountdownTimer(120, null, null);
        }
    }

    @Override
    protected void initData() {
    }

    @OnClick({R.id.showMainType_toShopping_btn, R.id.showMainType_toSweep_btn})
    @Override
    public void onClick(View view) {
        super.onClick(view);
        switch (view.getId()) {
            case R.id.showMainType_toShopping_btn:
                int haveAdv = ShareUtils.getInstance().getInt(ShareKey.IS_SHOP_TYPE);
                startActivity(haveAdv == 1 ? MainActivity.class : MainTypeActivity.class, null); // 按货道展示商品 - 按货商品类型示商品
                break;
            case R.id.showMainType_toSweep_btn:
                startActivity(PayForSweepActivity.class, null); // 开始扫码领取
                break;
        }
    }
}
